package com.zhuiyun.pm.config;

import lombok.Data;

@Data
public class CommonResult {
    private boolean flag=true;
    private String code="200";
    private Object obj;

    public  static CommonResult ok(){
        CommonResult commonResult = new CommonResult();
        return commonResult;
    }

    public  static CommonResult ok(Object obj){
        CommonResult commonResult = new CommonResult();
        commonResult.setObj(obj);
        return commonResult;
    }

    public  static CommonResult error(String code){
        CommonResult commonResult = new CommonResult();
        commonResult.setCode(code);
        commonResult.setFlag(false);
        return commonResult;
    }

    public  static CommonResult error(String code, Object obj){
        CommonResult commonResult = new CommonResult();
        commonResult.setCode(code);
        commonResult.setFlag(false);
        commonResult.setObj(obj);
        return commonResult;
    }
}

